home *** CD-ROM | disk | FTP | other *** search
- Thus wrote:
- >I have a couple of HTML servers written in perl, running
- >under SunOS Unix, invoked via inetd.
- >
- >Is there a way in perl to find out the internet address of the client?
- >Or do I have to give up the convenience of inetd to do that?
-
- I have an HTTP server written in perl, under SunOS Unix, as a
- standalone daemon without inetd. I considered inetd but am of the
- opinion that the performance would be unacceptable if perl had to
- parse the whole thing for every request. Forks are not that expensive
- in perl, and probably will be faster once we convert to a OpSys with
- copy-on-write. Thus, the code from mine looks more or less like the
- code on page 345 of the Camel book. It's running; URL
- http://cs.indiana.edu/ if you want to peek. I plan to release the
- code once it's stable, though people can have unstable copies if they
- really want.
-
- The following code is taken from page 153 of the Camel book, and
- probably does what you want:
-
- $sockaddr = 'S n a4 x8';
- $mysockaddr = getsockname(S);
- ($family, $port, $myaddr) = unpack($sockaddr, $mysockaddr);
-
- - Marc
-